export default {
  namespaced:true,
  state:()=>({
    address:JSON.parse(uni.getStorageSync('guangtou-shop-user-address')||'{}')
  }),
  mutations:{
    updateAddress(state,newAddress){
      state.address=newAddress
      this.commit('m_user/saveToStorage')
      console.log(newAddress)
    },
    saveToStorage(state){
      uni.setStorageSync('guangtou-shop-user-address',JSON.stringify(state.address))
    }
  },
  getters:{
    AddressStr(state){
      if(!state.address.provinceName) return ''
      return state.address.provinceName+state.address.cityName+state.address.countyName+state.address.detailInfo
    }
  },
  
}